<template>
  <el-input
    :readonly="service.readonly"
    :modelValue="val"
    type="textarea"
    @update:modelValue="updateValue($event)"
    :placeholder="service.placeholder || ''"
    :autosize="ui.autosize"
    :rows="ui.rows || 6"
    :disabled="ui.disabled"
    :maxlength="ui.maxLength"
    :showWordLimit="!!ui.maxLength"
  />
</template>

<script lang="ts" setup name="lc-sf-textarea">
import { inject, computed } from "vue";
import { TextAreaUI } from "../interface";
import { SFService } from "../sf.service";
import { TItemOption } from "../type";
const props = defineProps<TItemOption<TextAreaUI>>();
const sf = inject<SFService>("sf-service");
const val = computed(() => {
  return sf.getVaule(props.keyPath);
});
const ui = props.service.getUI<TextAreaUI>();
const updateValue = (val: string) => {
  if (ui.change) {
    ui.change(val);
  }
  sf.setVaule(props.keyPath, val);
};
</script>

<style></style>
../types
